import request from "./request";
// 修改用户
export function editUser(data) {
    return request({
      url: `/mgr/jvs-auth/user/update`,
      method: "put",
      data: data
    });
}

// 获取当前用户信息
export function getUserInfo() {
    return request({
      url: "/mgr/jvs-auth/index/user/info",
      method: "get"
    });
}

// 修改账号头像
export function updateAccountHead(key, value) {
    let url = `/mgr/jvs-auth/index/update/account?${key}=${value}`
    if(key == 'headImg') {
      url = `/mgr/jvs-auth/index/bind/headImg?${key}=${value}`
    }
    return request({
      url: url,
      method: "put"
    });
}

  // 修改密码
export function setPassWord(data) {
    return request({
      url: "/mgr/jvs-auth/index/user/change/password",
      method: "post",
      data: data
    });
}
// 绑定微信
export function bindWX(params) {
  return request({
    url: "/mgr/jvs-auth/index/bind/wx",
    method: "put",
    params: params
  });
}

// 解除微信绑定
export function unbindWX() {
  return request({
    url: "/mgr/jvs-auth/index/bind/wx",
    method: "delete"
  });
}
// 企业微信绑定
export function bindQW(params) {
  return request({
    url: `/mgr/jvs-auth/index/bind/wxenterprise`,
    method: "put",
    params: params
  });
}

// 解除企业微信绑定
export function unbindQW() {
  return request({
    url: "/mgr/jvs-auth/index/bind/wxenterprise",
    method: "delete"
  });
}

// 绑定钉钉
export function bindDD (params) {
  return request({
    url: "/mgr/jvs-auth/index/bind/ding",
    method: "put",
    params: params
  });
}

// 解除钉钉绑定
export function unbindDD () {
  return request({
    url: "/mgr/jvs-auth/index/bind/ding",
    method: "delete"
  });
}

// 绑定LDAP
export function bindLDAP (params) {
  return request({
    url: "/mgr/jvs-auth/index/bind/ldap",
    method: "put",
    params: params
  });
}

// 解除LDAP绑定
export function unbindLDAP () {
  return request({
    url: "/mgr/jvs-auth/index/bind/ldap",
    method: "delete"
  });
}
// 解除手机绑定
export function unbindPhone() {
  return request({
    url: "/mgr/jvs-auth/index/bind/phone",
    method: "delete"
  });
}
// 解绑邮箱
export function unbindEmail() {
  return request({
    url: "/mgr/jvs-auth/index/bind/email",
    method: "delete"
  });
}
// 发送邮箱验证码
export function sendEmailCode(params) {
  return request({
    url: "/mgr/jvs-auth/index/send/email/code",
    method: "get",
    params: params
  });
}
// 发送手机验证码
export function sendPhoneCode(phone) {
  return request({
    url: `/auth/phone/sms/bind/${phone}`, // `/auth/phone/sms/verification/${phone}`,
    method: "get",
  });
}
// 绑定手机
export function bindPhone(data) {
  return request({
    url: "/mgr/jvs-auth/index/bind/phone",
    method: "put",
    params: data
  });
}
// 绑定邮箱
export function bindEmail(data) {
  return request({
    url: "/mgr/jvs-auth/index/bind/email",
    method: "put",
    params: data
  });
}
